package day014.homework.p4;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6};
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            list.add(arr[i]);
        }
        System.out.println(getIndex(list, 3));
    }

    public static int getIndex(ArrayList<Integer> list, Integer num) {

        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).equals(num)) {
                return i;
            }
        }

        return -1;
    }
}
